<template>
  <div class="expendes">
    <!-- 顶部搜索区域 -->
    <el-card>
      <el-form :model="searchDate" label-width="80px">
        <el-row class="demo-ruleForm-row">
          <el-col :span="6">
            <el-form-item label="项目名称">
              <el-input v-model="searchDate.name"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="招标编号">
              <el-input v-model="searchDate.info_number"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <div class="search_col">
              <el-button type="primary" size="mini" icon="el-icon-search">搜索</el-button>
              <el-button type="primary" size="mini" icon="el-icon-refresh" @click="resetForm">重置</el-button>
            </div>
          </el-col>
         </el-row>
      </el-form>
    </el-card>

     <!-- 卡片视图区域 -->
    <el-card class="card">
      <el-row>
        <el-col :span="6">
          <el-button type="primary" size="mini">批量审核</el-button>
        </el-col>
      </el-row>
      <el-table
      :data="tableDate"
      :row-class-name="tableRowClassName"
      style="width: 100%"
      border
      ref="refTable"
      :header-cell-style="{
        'background-color': '#CBD9EC',
        color: '#fff',
        'font-weight': '400',
      }"
      @selection-change="handleSelectionChange">
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column width="60" label="序号" type="index"></el-table-column>
        <el-table-column prop="name" label="招标项目名称" width="240"></el-table-column>
        <el-table-column prop="info_number" label="招标编号"> </el-table-column>
        <el-table-column prop="announcement" label="公告发布时间"> </el-table-column>
        <el-table-column prop="time" label="开标时间"> </el-table-column>
        <el-table-column prop="region" label="地区"></el-table-column>
        <el-table-column prop="procurement_people" label="采购人"></el-table-column>
        <el-table-column prop="procurement_contact" label="采购联系人"> </el-table-column>
        <el-table-column prop="institutions" label="代理机构"> </el-table-column>
        <el-table-column prop="responsibility" label="项目负责人"></el-table-column>
        <el-table-column prop="mobile" label="联系方式"></el-table-column>
        <el-table-column prop="procurement_way" label="采购方式"></el-table-column>
        <el-table-column prop="money" label="预算/拟分包金额（万元）"></el-table-column>
        <el-table-column label="操作" class="operation" width="100px">
          <template slot-scope="scope">
            <el-row class="agree-row">
              <el-button type="primary" size="mini" @click="agreeClick(scope.row)">通过审核</el-button>
            </el-row>
            <el-row>
              <el-button type="primary" size="mini" @click="rejectedClick(scope.row)">驳回审核</el-button>
            </el-row>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页 -->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.mount"
        :page-sizes="[1, 3, 6, 10]"
        :page-size="page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      // 搜索数据
      searchDate: {
        name: '',
        info_number: '',
      },

      // 第一个表格
      tableDate: [
        {
          id: 1,
          name: '国网江西省电力有限公司上饶供电分公司集体企业2020年第002批物资类招标',
          info_number: 'JXRY2020-SR-002-JT(WZ)',
          announcement: '公告',
          time: '2020年6月6日下午16:30时',
          region: '地区',
          procurement_people: '采购人',
          procurement_contact: '采购联系人',
          institutions: '机构1',
          responsibility: '项目负责人',
          mobile: '联系方式',
          procurement_way: '采购方式',
          money: 383.46696,
          audit_status: 0,
        },
        {
          id: 5,
          name: '国网江西省电力有限公司上饶供电分公司集体企业2020年第002批物资类招标',
          info_number: 'JXRY2020-SR-002-JT(WZ)',
          announcement: '公告',
          time: '2020年6月6日下午16:30时',
          region: '地区',
          procurement_people: '采购人',
          procurement_contact: '采购联系人',
          institutions: '机构1',
          responsibility: '项目负责人',
          mobile: '联系方式',
          procurement_way: '采购方式',
          money: 383.46696,
          audit_status: 0,
        },
      ],
      // 存储选中的数据
      checkboxList: [],

      // 分页数据
      page: {
        // 每页显示几条数据
        size: 6,
        // 当前页码值
        mount: 0,
      },
      // 总数据条数
      total: 6,
    }
  },
  methods: {
    // 每页数据显示条数改变时触发
    handleSizeChange(newSize) {
      console.log(newSize)
    },
    // 页码值发生改变时触发
    handleCurrentChange(newPage) {
      console.log(newPage)
    },

    // 重置
    resetForm() {
      
    },

    // 全选
    handleSelectionChange(val) {
      this.checkboxList = val;
      console.log(this.checkboxList);
    },

    // 隔行变色
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex === 1) {
        return 'warning-row'
      } else if (rowIndex === 3) {
        return 'success-row'
      }
      return ''
    },

    // 同意
    agreeClick(row) {
      console.log(row);
    },
    // 驳回
    rejectedClick(row) {
      console.log(row);
    },
  }
}
</script>

<style>
.expendes{
    padding: 20px;
}
.agree-row {
  margin-bottom: 5px;
}
</style>